<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="gmms" uri="/gmms-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>用户管理</title>
<jsp:include page="../head.jsp" />
<script language="javascript">
function search(){
	$(".departmentId").val($("#departmentId4Search").val());
	$(".userName").val($("#userName4Search").val());
	$(".currentPage").val(1);
	if (!checkForm(document.getElementById("refreshForm"))) {
		return;
	}
	xbox.load("loading");
	$("#refreshForm").submit();
}
function resetSearch(){
	xbox.load("loading");
	$(".departmentId").val(null);
	$(".userName").val("");
	$(".currentPage").val(1);
	$("#refreshForm").submit();
}
function checkAll(){
	if($("#btnCheck").attr("value")=="全选"){
		$("#btnCheck").attr("value","取消");
		$("#btnCheck").removeClass("btn-success");
		$("#btnCheck").addClass("btn-warning");
		$("input[name='checkbox']").each(function(){this.checked=true;});
	}else{
		$("#btnCheck").attr("value","全选");
		$("#btnCheck").removeClass("btn-warning");
		$("#btnCheck").addClass("btn-success");
		$("input[name='checkbox']").each(function(){this.checked=false;});
	}
	
}
function toChoose(){
	var ids="";
	var names="";
	$("input[name='checkbox']").each(function(){
		if(this.checked){
			ids+=$(this).val()+",";
			names+=$(this).attr("showname")+",";
		}
	});
	if(ids==""){
		j_tip("您没有选择任何用户", 'error');
	}else{
		alert(ids);
		alert(names);
		//parent.rollbackChoose(ids,names);
	}
}
</script>
</head>
<body>

<div class="info_right_main">

<!--<div class="info_right_tit">*<span><a style="font-size:12px; color:#999;" href="#">*</a><a style="font-size:12px; color:#999;" href="<%=path %>/default.action" target="_top">-首页</a></span></div>-->
	        <div class="info_right_tab">
	        	<ul style="margin-top:30px;">
	            	<li style="width:70px;">所属部门：</li>
	                <li>
						<select name="departmentId" id="departmentId4Search"  style="width:150px;">
								<option value="">全部</option>
				          	<c:forEach items="${departmentList}" var="dep">
				          		<option value="${dep.departmentId}" <c:if test="${dep.departmentId eq departmentId}">selected="selected"</c:if>>${dep.departmentName}</option>
				          	</c:forEach>
				          </select>
					</li>
	                <li style="width:70px;">用户姓名：</li>
	                <li><input type="text" id="userName4Search" name="userName" value="${userName}" class="info_right_input"  maxlength="15" /></li>
	                <li style="width:280px;">
	                <input class="btn" onclick="search()" id="btnSearch" type="button" value="查询" /> 
	                <input class="btn" onclick="resetSearch()" type="button" value="重置" />
	                <input class="btn btn-success" onclick="checkAll()" id="btnCheck" type="button" value="全选" /> 
	                <input class="btn btn-primary" onclick="toChoose()" id="btnCheck" type="button" value="选定" /> 
	                </li>
	            </ul>
		</div>
        
        
<div class="info_right_main">
     <table width="100%" border="0" cellspacing="0" cellpadding="5">
	       <c:forEach items="${list}" var="user" varStatus="status">
	       <c:if test="${(status.index+5)%5==0 }">
	       		<tr align='center' bgcolor="#FFFFFF" height="30" >	
	       </c:if>
					<td width="50" align="right"><input type="checkbox" name="checkbox" value="${user.userId }" showname="${user.realName}"  /></td>
					<td width="100" align="left"><strong>${user.realName}</strong></td>
					 <c:if test="${(status.index+5)%5==4 }">
				</tr>
				</c:if>
			</c:forEach>
     </table>
</div>
  
</div>


<form action="<%=path%>/user/user_queryAllUserList_checkuserAction.action" method="post" style="display: none;" id="refreshForm" name="refreshForm">
	<input type="hidden" name="currentPage" class="currentPage" value="${currentPage}"/>
	<input type="hidden" class="departmentId" name="departmentId" value="${departmentId}"/>
	<input type="hidden" class="userName" name="userName" value="${userName}"/>
	<input type="hidden" class="currentMenuId" name="currentMenuId" value="${currentMenuId}"/>
</form>

</body>
</html>
